package galileo;

import actions.AddCategoryAction;
 
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

	private IWorkbenchAction exitAction;
	private IWorkbenchAction minAction;
	private IWorkbenchAction aboutAction;
	private IWorkbenchAction addCategoryAction;
	
    public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
        super(configurer);
    }

    protected void makeActions(IWorkbenchWindow window) {
    	exitAction = ActionFactory.QUIT.create(window);
		register(exitAction);
		
		minAction = ActionFactory.MINIMIZE.create(window);
		register(minAction);
		
		aboutAction = ActionFactory.ABOUT.create(window);
		register(aboutAction);
		
		addCategoryAction = new AddCategoryAction(window);
		register(addCategoryAction);
    }

    protected void fillMenuBar(IMenuManager menuBar) {
    	MenuManager galileoMenu = new MenuManager("&File", "file");
    	galileoMenu.add(minAction);
    	galileoMenu.add(exitAction);
    	
    	MenuManager helpMenu = new MenuManager("&Help", "help");
		helpMenu.add(aboutAction);
    	
		MenuManager categoriesMenu = new MenuManager("&Categories", "categories");
		categoriesMenu.add(addCategoryAction);
		
		menuBar.add(galileoMenu);
		menuBar.add(categoriesMenu);
		menuBar.add(helpMenu);	
    }
    
}
